{extend name="main/index" /}
{block name="main"}

<div class="content-page">
    <div class="content">
        <div class="row">
            <div class="widget-header transparent">
                <h4><strong>用户管理 </strong>
                    <small>》</small>
                    修改用户
                </h4>
            </div>
            <form class="form-horizontal"  method="post" id="my">
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" id="uname" name="name" value="{$list.name}">
                        <input type="hidden" name="id" value="{$list.id}" class="nid">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">手机号</label>
                    <div class="col-sm-6">
                        <input type="text" name="tel" class="form-control" id="tel" value="{$list.tel}">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">修改密码</label>
                    <div class="col-sm-6">
                        <input type="password" name="pwd" class="form-control" id="password">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">确认密码</label>
                    <div class="col-sm-6">
                        <input type="password" name="repwd" class="form-control" id="repassword">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="update" class="btn btn-primary " id="sub">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    {/block}



{block name="myjs"}
    <script>
        // 设置弹框参数
        toastr.options = {
            closeButton: true,//是否显示关闭按钮
            progressBar: true,//实现显示计时条
            timeOut: "3000",//自动关闭时间
            positionClass: "toast-bottom-left"//提示位置
            // toast-top-full-width 顶端，宽度铺满整个屏幕
            // toast-top-right  顶端右边
        };



        $('#sub').click(function(){
            var info = $('#my input').serialize();
            console.log(info);
            $.ajax({
                url: '/admin/user/doEdit',
                type: 'put',
                data: 'id='+id,
                success: function (data) {
                        if (data.status) {
                            toastr.success(' 用户更新成功！');
                            // window.location.reload();//刷新当前页面.
                            // return false;
                        } else{
                            toastr.error(' 用户更新失败！');
                            // return false;
                        }
                    },
                    error:function(){
                        alert('ajax执行失败');
                    }
            });

        })


    </script>

{block}